package com.seuic.hnjiningposapp.hnapps.ui.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;

import com.lxj.xpopup.core.BasePopupView;
import com.seuic.hnjiningposapp.R;
import com.seuic.hnjiningposapp.hnapps.util.GetMoneyLvUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 他行取款 确定信息
 */
public class SureToHelpFarmersWithdrawOtherPp extends BasePopupView {
    Unbinder bind;
    @BindView(R.id.accnum)
    TextView accnum;
    @BindView(R.id.usernmae)
    TextView usernmae;
    @BindView(R.id.balance)
    TextView balance;
    @BindView(R.id.inputlayout)
    RelativeLayout inputlayout;
    @BindView(R.id.money)
    TextView money;
    @BindView(R.id.suremoneylayout)
    RelativeLayout suremoneylayout;
    @BindView(R.id.sure_switchinfo_yesbtn)
    Button sureSwitchinfoYesbtn;
    @BindView(R.id.sure_switchinfo_layout)
    CardView sureSwitchinfoLayout;
    SureToHelpFarmersCall mSureToHelpFarmersCall;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.sure_switchinfo_nobtn)
    Button sureSwitchinfoNobtn;

    public SureToHelpFarmersWithdrawOtherPp(@NonNull Context context, SureToHelpFarmersCall sureToHelpFarmersCall) {
        super(context);
        mSureToHelpFarmersCall = sureToHelpFarmersCall;

    }

    @Override
    protected int getPopupLayoutId() {
        return R.layout.tohelpfarmerswithdrawotherpp;
    }


    String card_num;
    String user_name;
    String userbalance;
    String moneys;
    String titles;

    public void setCard_num(String card_num) {
        this.card_num = card_num;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public void setUserbalance(String userbalance) {
        this.userbalance = userbalance;
    }

    public void setMoneys(String moneys) {
        this.moneys = moneys;
    }

    public void setTitles(String titles) {
        this.titles = titles;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        bind = ButterKnife.bind(this);
        sureSwitchinfoNobtn.setVisibility(VISIBLE);
        inputlayout.setVisibility(View.GONE);
        suremoneylayout.setVisibility(VISIBLE);
        title.setText(titles);

        accnum.setText(card_num);
        usernmae.setText(user_name);
        balance.setText(GetMoneyLvUtils.getMoney(userbalance));
        money.setText(GetMoneyLvUtils.getInputMoney(moneys) + "元");

    }

    @Override
    protected void onDismiss() {
        super.onDismiss();
        //注解解绑
        if (bind != null && bind != Unbinder.EMPTY) {
            bind.unbind();
        }
        this.bind = null;
    }

    @OnClick({R.id.sure_switchinfo_nobtn, R.id.sure_switchinfo_yesbtn})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.sure_switchinfo_nobtn:
                mSureToHelpFarmersCall.notsure();
                break;
            case R.id.sure_switchinfo_yesbtn:
                mSureToHelpFarmersCall.sureFarmersCall();
                break;
        }
    }


    public interface SureToHelpFarmersCall {
        void sureFarmersCall();

        void notsure();
    }

}
